package com.hu.zhcc.shiro.service.Appointment;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.shiro.dao.TSetmealMapper;
import com.hu.zhcc.shiro.entity.Appointment.Entry;
import com.hu.zhcc.shiro.entity.Appointment.TSetmeal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TSetmealServiceImpl implements TSetmealService {

    @Autowired
    private TSetmealMapper setmealMapper;

    @Override
    public Page<TSetmeal> selectTSetmealAll(Map<String, String> map, String value) {
        Integer offset = Integer.valueOf(map.get("offset"));
        Integer limit = Integer.valueOf(map.get("limit"));
        PageHelper.startPage(offset, limit);
        List<TSetmeal> tSetmeals = setmealMapper.selectTSetmealAll(value);
        PageInfo<TSetmeal> pageInfo = new PageInfo<>(tSetmeals);
        return new Page<TSetmeal>(pageInfo.getTotal(), tSetmeals);
    }

    @Override
    public Page<TSetmeal> tsetMealAll(Map<String, String> map, String value) {
        Integer offset = Integer.valueOf(map.get("offset"));
        Integer limit = Integer.valueOf(map.get("limit"));
        PageHelper.startPage(offset, limit);
        List<TSetmeal> tSetmeals = setmealMapper.tsetMealAll(value);
        PageInfo<TSetmeal> pageInfo = new PageInfo<>(tSetmeals);
        return new Page<TSetmeal>(pageInfo.getTotal(), tSetmeals);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return setmealMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertSelective(TSetmeal record) {
        return setmealMapper.insertSelective(record);
    }

    @Override
    public TSetmeal beforeSelectMeal(int id) {
        return setmealMapper.beforeSelectMeal(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TSetmeal record) {
        return setmealMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public TSetmeal findTSetmealByReservationId(int id) {
        return setmealMapper.findTSetmealByReservationId(id);
    }

    @Override
    public List<Entry> findALlEntryByReservationId(int id) {
        return setmealMapper.findALlEntryByReservationId(id);
    }

    @Override
    public List<Entry> allEntry(int id) {
        return setmealMapper.allEntry(id);
    }

    @Override
    public List<TSetmeal> findAllTSetmeal(String value) {
        return setmealMapper.selectTSetmealAll(value);
    }

    @Override
    public List<TSetmeal> connectionEntryTeam(Map map) {
        return setmealMapper.connectionEntryTeam(map);
    }

    @Override
    public int deleteTeam(int id) {
        return setmealMapper.deleteTeam(id);
    }

    @Override
    public List<TSetmeal> selectAllMeal() {
        return setmealMapper.selectAllMeal();
    }
}
